package edu.pku.taas.hyperic.types2;

import java.sql.ResultSet;
import java.sql.SQLException;

public class MeasurementBuilder {
	class MeasurementTable {
		public static final String ID = "ID";
		public static final String INSTANCE_ID = "INSTANCE_ID";
		public static final String TEMPLATE_ID = "TEMPLATE_ID";
		public static final String ENABLED = "ENABLED";
		public static final String RESOURCE_ID = "RESOURCE_ID";
		public static final String DSN = "DSN";
		public static final String NAME = "NAME";
	}
	public static Measurement  buildeMeasurement(ResultSet rs) throws SQLException {
		Measurement m = new Measurement();
		m.setId( rs.getInt(MeasurementTable.ID));
		m.setInstanceId(rs.getInt(MeasurementTable.INSTANCE_ID));
		m.setTemplateId( rs.getInt(MeasurementTable.TEMPLATE_ID));
		m.setResourceId( rs.getInt(MeasurementTable.RESOURCE_ID));
		m.setEnabled(rs.getBoolean(MeasurementTable.ENABLED));
		m.setDsn(rs.getString(MeasurementTable.DSN));
		m.setName(rs.getString(MeasurementTable.NAME));
		
		return m;
	}
	public static void main(String[] args) {
		// TODO Auto-generated method stub

	}

}
